using System.Windows.Forms;
using ClientApi;
using CommonGui;
using DataModel;

namespace RitaReports.Travels
{
    public class TravelsMap : IReportMap
    {
        #region IReportMap Members

        public string GetBookmarkDisplayText(string bookmarkText)
        {
            return string.Format("Request {0}", bookmarkText);
        }

        public void ShowBookmarkDetails(IReportDataSource reportDataSource, string bookmarkText, IWin32Window owner)
        {
            TravelsDataSource dataSource = (TravelsDataSource)reportDataSource;
            long requestId = long.Parse(bookmarkText);

            foreach (HistoryDescr history in dataSource.History)
            {
                if (history.RqstId == requestId)
                {
                    RequestHistoryForm.ShowRequestHistory(owner, history);
                    return;
                }
            }
        }

        #endregion
    }
}
